﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace BDSim
{
    /// <summary>
    /// 用户类型
    /// </summary>
    public enum EUserType
    {
        /// <summary>
        /// 静态用户
        /// </summary>
        StaticUser,
        /// <summary>
        /// 汽车
        /// </summary>
        Car,
        /// <summary>
        /// 
        /// </summary>
        Aircraft,
        /// <summary>
        /// 船
        /// </summary>
        Boat,
        /// <summary>
        /// 弹道用户
        /// </summary>
        Missile,
        /// <summary>
        /// 航天器
        /// </summary>
        SpaceVehicle,
        /// <summary>
        /// 用户自定义类型，主要为测试轨迹提供载体
        /// </summary>
        CustomUser,
    }

    /// <summary>
    /// 姿态信息结构体
    /// </summary>
    public struct Attitude
    {
        /// <summary>
        /// 偏航角
        /// </summary>
        public double Yaw;
        /// <summary>
        /// 俯仰角
        /// </summary>
        public double Pitch;
        /// <summary>
        /// 滚动角
        /// </summary>
        public double Roll;
    }

    /// <summary>
    /// 用户的RTK设置，标明其是基准站还是流动站
    /// </summary>
    public enum ERTKType
    {
        /// <summary>
        /// 基准站
        /// </summary>
        ReferenceStation,
        /// <summary>
        /// 移动站
        /// </summary>
        MovableStation,
    }

    /// <summary>
    /// 用户定位模式
    /// </summary>
    public enum EPositionType
    {
        最小二乘法,
        //抗差最小二乘法,
        //kalman滤波,
        //抗差kalman滤波,
        //抗差自适应kalman滤波,
    }

    /// <summary>
    /// 接收机的安装矩阵，三个欧拉角表示
    /// </summary>
    public struct RecInstallMatrix
    {
        public double Alfa;
        public double Beta;
        public double Gama;
    }

    /// <summary>
    /// 用户轨迹数据来源类型
    /// </summary>
    public enum ETrackGenType
    {
        /// <summary>
        /// 外部导入方式
        /// </summary>
        Import,
        /// <summary>
        /// 配置轨迹文件仿真生成
        /// </summary>
        Simulation,
    }

    /// <summary>
    /// 接收机类型
    /// </summary>
    public enum ERecType
    {
        /// <summary>
        /// 接收BD2系统的信号
        /// </summary>
        BD,
        /// <summary>
        /// 接收GPS系统的信号
        /// </summary>
        GPS,
        /// <summary>
        /// 接收GLONASS系统的信号
        /// </summary>
        GLONASS,
        /// <summary>
        /// 接收GALILEO系统的信号
        /// </summary>
        GALILEO,
        /// <summary>
        /// 接收BD和gps系统的信号
        /// </summary>
        BD_GPS,
    }

    /// <summary>
    /// 四大系统的频点
    /// </summary>
    public enum EFrePoint
    {
        /// <summary>
        /// BD2系统的B1频点,1561.098MHz
        /// </summary>
        BD_B1,
        /// <summary>
        /// BD2系统的B2频点,1207.14MHz
        /// </summary>
        BD_B2,
        /// <summary>
        /// BD2系统的B3频点,1268.52MHz
        /// </summary>
        BD_B3,
        /// <summary>
        /// GPS系统的L1频点1575.42MHz
        /// </summary>
        GPS_L1,
        /// <summary>
        /// GPS系统的L2频点1227.60MHz
        /// </summary>
        GPS_L2,
        /// <summary>
        /// GPS系统的L5频点,1176.45MHz
        /// </summary>
        GPS_L5,
        /// <summary>
        /// GLONASS系统的L1频点,1602+k*9116MHz
        /// </summary>
        GLONASS_L1,
        /// <summary>
        /// GLONASS系统的L2频点1246+k*716MHz
        /// </summary>
        GLONASS_L2,
        /// <summary>
        /// GALILEO系统的E1频点1575.42MHz
        /// </summary>
        GALILEO_E1,
        /// <summary>
        /// GALILEO系统的E5a频点,1176.45MHz
        /// </summary>
        GALILEO_E5a,

        /// <summary>
        /// GALILEO系统的E5a频点,1207.14MHz
        /// </summary>
        GALILEO_E5b,
    }

    #region 轨迹仿真增加结构体
    /*单点轨迹信息类*/
    [StructLayout(LayoutKind.Sequential)]
    public struct OutPoint
    {
        //================和Spirent轨迹对比所需的用户轨迹信息=========================
        //注：Siprent系统定义的坐标系：ECEF坐标系    导航坐标系(北X 东Y 地Z) 载体坐标系 （前X 右Y 下Z） 
        // *********变量上方为对应的Spirent的输出************
        //Time_ms
        public long m_time;          //数据对应的时间 单位 ms
        //Pos_X Pos_Y Pos_Z
        public double x, y, z;					//载体位置信息     空间直角坐标系 xyz   ECEF坐标系
        //Vel_X Vel_Y Vel_Z 
        public double vx, vy, vz;			    //载体相对地球的速度信息       三轴速度		ECEF坐标系
        //Acc_X Acc_Y Acc_Z
        public double ax, ay, az;				//载体相对地球的加速度信息		ECEF坐标系
        //Jerk_X Jerk_Y Jerk_Z 
        public double jjx, jjy, jjz;				//载体相对地球的加加速度信息		ECEF坐标系
        //Long Lat Height
        public double lon, lat, high;            //载体位置信息     经纬度高程
        //Elevation Bank Heading     俯仰Y轴 横滚X轴 航向Z轴
        public double pitch, roll, yaw;		    //载体姿态信息             pitch 俯仰   roll横滚  yaw航向  
        //Ang-vel_X Ang-vel_Y Ang-vel_z
        public double wx, wy, wz;		    //载体相对ECEF旋转角速度在载体系下的投影？？？？
        //Ang-acc_X Ang-acc_Y Ang-acc_Z 
        public double wjx, wjy, wjz;		 //载体相对ECEF角加速度在载体系下的投影？？？？

        //=================惯性仿真所需要的数据===================================
        //注：此处的所有输出所用到的坐标系定义：ECEF；导航坐标系(东X 北Y 天Z)；载体坐标系（右X 前Y 上Z）

        //2.载体相对84系的角速度、角加速度 在84系下的投影 即 Webe  WebeD
        public double WebeX, WebeY, WebeZ;
        public double WebeDX, WebeDY, WebeDZ;

        //3.载体相对84系的 速度 加速度 加加速度  在导航系下的投影  Vnbn Anbn Jnbn 若需要北东地的输出 X Y调换 Z加-号
        public double VnbnX, VnbnY, VnbnZ;
        public double AnbnX, AnbnY, AnbnZ;
        public double JnbnX, JnbnY, JnbnZ;

        //4. 载体相对导航系的旋转 角速度 角加速度 在载体系下的投影  Wnbb WnbbD  若需要前后下的输出 X Y调换 Z加-号
        public double WnbbX, WnbbY, WnbbZ;
        public double WnbbXD, WnbbYD, WnbbZD;

        //======================其它========================================
        // 	double wx,wy,wz;			    
        // 	double wjx,wjy,wjz;			

        public double bvx, bvy, bvz;
        public double bax, bay, baz;
        public double bjjx, bjjy, bjjz;

        public double pitchD, rollD, yawD;
        public double pitchDD, rollDD, yawDD;
        public double pitchDDD, rollDDD, yawDDD;

        public double WebbDX, WebbDY, WebbDZ;
        public double WebbX, WebbY, WebbZ;

        //public OutPoint()
        //{
        //    m_time = 0;
        //    lon = lat = high = 0.0;
        //    x = y = z = 0.0;
        //    vx = vy = vz = 0.0;
        //    ax = ay = az = 0.0;
        //    jjx = jjy = jjz = 0.0;
        //    pitch = roll = yaw = 0.0;
        //    wx = wy = wz = 0.0;
        //    wjx = wjy = wjz = 0.0;

        //    bvx = bvy = bvz = 0.0;
        //    bax = bay = baz = 0.0;
        //    bjjx = bjjy = bjjz = 0.0;

        //    pitchD = 0.0; rollD = 0.0; yawD = 0.0;
        //    pitchDD = 0.0; rollDD = 0.0; yawDD = 0.0;
        //    pitchDDD = 0.0; rollDDD = 0.0; yawDDD = 0.0;

        //    WebeX = WebeY = WebeZ = 0.0;
        //    WebeDX = WebeDY = WebeDZ = 0.0;
        //    VnbnX = VnbnY = VnbnZ = 0.0;
        //    AnbnX = AnbnY = AnbnZ = 0.0;
        //    JnbnX = JnbnY = JnbnZ = 0.0;
        //    WnbbX = WnbbY = WnbbZ = 0.0;
        //    WnbbXD = WnbbYD = WnbbZD = 0.0;
        //    WebbX = WebbY = WebbZ = 0.0;      //载体相对ECEF旋转角速度在载体系下的投影
        //    WebbDX = WebbDY = WebbDZ = 0.0;
        //}
    };

    /// <summary>
    /// 飞机动态仿真指令类型
    /// </summary>
    public enum AirCmdType
    {
        Ref, GreatCircle, AirLine, AirAcc, AirTurn, AirTurnAcc, AirClimb, AirWayPoint, AirCombined, AirLinePitch, AirLineRoll,
        AirLineYaw, AirHalt, Round, RoundTrip, AccLine
    };

    /// <summary>
    /// 飞机动态仿真异常
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct AirExceptionMsg
    {
        /*当前计算命令类型*/
        public AirCmdType cmdType;

        /*异常类型 expType=10:说明在计算阶段*/
        public short expType;

        /*边界值*/
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
        public double[] refBoundary;
    };

    /// <summary>
    /// 汽车动态仿真指令类型
    /// </summary>

    public enum CarCmdType
    {
        Ref, GreatCircle, CarLineConst, CarLineAcc, CarTurnConst, CarClimb, CarPoint, CarHalt,
        Round, RoundTrip
    };

    /// <summary>
    /// 汽车动态仿真异常
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct CarExceptionMsg
    {
        /*当前计算命令类型*/
        public CarCmdType cmdType;

        /*异常类型 expType=10:说明在计算阶段*/
        public short expType;

        /*边界值*/
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
        public double[] refBoundary;
    };

    /*Ref:起始点设定            AirLine:飞机稳速直线		AirAcc:飞机加速直线				
  AirTurn:飞机稳速转弯	    AirWayPoint:飞机定点行驶    AirCombined:飞机组合命令
  AirTurnAcc:飞机加速转弯   AirClimb:飞机爬升			AirPitch:飞机直线俯仰			
  AirRoll:飞机直线横滚	    AirYaw:飞机直线航向	        GreatCircle:大圆运动			
  Round:圆周运动  RoundTrip:匀速往返运动  AccLine：加速直线 */
    public enum BoatCmdType
    {
        Ref, GreatCircle, BoatLineConst, BoatLineAcc, BoatTurnConst, BoatPoint, BoatHalt, Round, RoundTrip
    };

    /*异常信息*/
    [StructLayout(LayoutKind.Sequential)]
    public struct BoatExceptionMsg
    {
        /*当前计算命令类型*/
        public BoatCmdType cmdType;

        /*异常类型 expType=10:说明在计算阶段*/
        public short expType;

        /*边界值*/
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
        public double[] refBoundary;
    };

    /// <summary>
    /// 弹道用户输入参数
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct MissileTrackInput
    {
        public double GroundReflection;// 地面反射系数  //gyd 0413增
        public double WallReflection;// 墙面反射系数
        public double HeightToGround;// 天线离地面高度
        public double VerticalDistanceToWall;// 天线离墙面的垂直距离
        public double Gr;             //地面站天线增益   //gyd 0416改接口
        public double Lant;           //天线损耗
        //
        public UTCTime CurTime;//当前时间，JD必须给出
        public UTCTime LaunchTime;//发射时间，JD必须给出
        public BLH_PosVel Launchpoint;//发射点位置
        public double LaunchAzimuth;//发射点的方位角
        public double ShotRange;//射程
        public double ExpireHeight;//关机点的高度
        public double ActivePeriod;//主动段飞行时间

    };

    /// <summary>
    /// 弹道用户输出参数
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct MissileTrackoutput
    {
        public double GroundReflection;// 地面反射系数  //gyd 0413增
        public double WallReflection;// 墙面反射系数
        public double HeightToGround;// 天线离地面高度
        public double VerticalDistanceToWall;// 天线离墙面的垂直距离
        public double Gr;             //地面站天线增益   //gyd 0416改接口
        public double Lant;
        //
        public double CurrentX;// 当前时间地固系下用户数据
        public double CurrentY;
        public double CurrentZ;
        public double CurrentVX;
        public double CurrentVY;
        public double CurrentVZ;
        public double CurrentAX;
        public double CurrentAY;
        public double CurrentAZ;
        public double CurrentADX;
        public double CurrentADY;
        public double CurrentADZ;
        public double NextX;// 下一时间地固系下用户数据
        public double NextY;
        public double NextZ;
        public double NextVX;
        public double NextVY;
        public double NextVZ;
        public double NextAX;
        public double NextAY;
        public double NextAZ;
        public double NextADX;
        public double NextADY;
        public double NextADZ;
    };

    #endregion 轨迹仿真增加结构体

}
